Repository navigation
Delete merge branch after merging release PR - #31
Merged
Merged
Conversation
GitHub doesn't always delete the head branch after a PR is merged. Stale merge branches cause subsequent releases to fail. After a successful merge, wait for GitHub to mark the PR as merged and delete the head branch if it still exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
labkey-tchad
force-pushed
the
fb_overwriteStaleMergeBranch
branch
from
November 10, 2026 23:51
640d134 to
214fc41
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Testing showed GitHub marks a pushed PR as merged even when the head branch is deleted immediately (or atomically with the merge push). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cnathe
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
When PRs are merged, GitHub doesn't always delete the head branch (GitHub support has indicated that this is a known issue). A stale merge forward branch (e.g.
fb_bot_merge_26.7) causes the nextbranch-releaserun for that release to fail with "Previous merge forward was not resolved."Instead of working around stale branches in
branch-release,merge-releasenow explicitly deletes the head branch after successfully merging and pushing. This also cleans up fast-forward branches and the final merge forward of a release, which abranch-releaseworkaround would never touch. If GitHub has already deleted the branch, nothing is done. Other failures are reported as error annotations and don't fail the job since the merge itself succeeded. The squash merge path (SNAPSHOT version bump) is unchanged.Deleting the head branch immediately after pushing the merge is safe: testing in labkey-tchad/testAutomation (PRs 54-63) showed the PR is still marked as merged, even when the merge and branch deletion are pushed atomically.
Note: this doesn't clean up stale branches that already exist; those need to be deleted manually.
Related Pull Requests
Changes
Tasks